import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();

        int count = 0;
        count = Math.min(Math.min(method1(a, b, x), method2(a, b, y)), method3(a, b, x, y));

        System.out.println(count);

        sc.close();
    }

    //只用 x
    public static int method1(int a, int b, int x) {
        int count = 0;
        count += (a % x == 0 ? a / x : (a / x + 1));
        count += (b % x == 0 ? b / x : (b / x + 1));
        return count;
    }

    //只用 y
    public static int method2(int a, int b, int y) {
        int max = Math.max(a, b);
        return (max % y == 0 ? max / y : max / y + 1);
    }

    //x, y 都用
    public static int method3(int a, int b, int x, int y) {
        int count = 0;
        if (a > b) {
            count += ((b % y == 0) ? b / y : (b / y + 1));
            a -= count * y;
            count += ((a % x == 0) ? a / x : (a / x + 1));
        } else {
            count += ((a % y == 0) ? a / y : (a / y + 1));
            b -= count * y;
            count += ((b % x == 0) ? b / x : (b / x + 1));
        }
        return count;
    }
}